</head>
<body>
<div class="f-sep10"></div>
<div class="m-filter s-filter m-form">
	<form id="filter_form">
		栏目：
		<select id="cid" name="cid" onChange="ajaxload()">
			<option value="0">全部栏目</option>
			<!--foreach:{$category_list $vo}-->
			<option <?php if($vo['type']==0 || $vo['mid']<>$model_info['mid']){ ?>  value="0" style="background-color:#ccc"  disabled="disabled" <?php }else{ ?>  value="{$vo['cid']}" <?php } ?> >
			
                  {$vo['cname']}
              
			</option>
			<!--{/foreach}-->
		</select>
		&nbsp;&nbsp;内容排序：
		<select id="sequence" name="sequence" onChange="ajaxload()">
			<option value="1">更新时间 新->旧</option>
			<option value="2">更新时间 旧->新</option>
			<option value="3">内容ID 大->小</option>
			<option value="4">内容ID 小->大</option>
			<option value="5">添加时间 新->旧</option>
			<option value="6">添加时间 旧->新</option>
			<option value="7">访问次数 多->少</option>
			<option value="8">访问次数 少->多</option>
		</select>
        &nbsp;&nbsp;
          状态：
          <select id="status" name="status" onChange="ajaxload()">
          	<option value="0">全部</option>
            <option value="1">已发布</option>
            <option value="2">未发布</option>
          </select>
		&nbsp;&nbsp;
		推荐位：
		<select id="position" name="position" onChange="ajaxload()">
			<option value="0">默认</option>
			<!--foreach:{$position_list $vo}-->
			<option value="{$vo.id}"  <?php if($_GET['position']==$vo['id']){ ?> selected="selected" <?php } ?> >{$vo.name}</option>
			<!--{/foreach}-->
		</select>
		&nbsp;&nbsp;
		关键词：
		<input type="text" id="keyword" name="keyword" class="u-ipt u-ipt-3" />
		<button type="button" onClick="ajaxload()" class="u-btn u-btn-sm">搜索</button>
	</form>
</div>
<div class="f-sep10"></div>
<div class="m-hd m-tabs">
	<h2 class="u-tt">内容管理</h2>
	<div class="more"><a href="javascript:;" onClick="ajaxload();"><span class="icon">&#xf021;</span> 刷新</a></div>
	<ul>
		<li><a class="z-crt" href="javascript:;"><span class="icon">&#xf101;</span> 栏目列表</a></li>
		<li><a class="opentab" href="javascript:void(0);"  title="添加内容" url="<?php echo url('admin_content/add') ?>" href="javascript:;"><span class="icon">&#xf067;</span> 添加内容</a></li>
	</ul>
</div>
<div class="m-list-table">
	<table class="m-table m-table-row" id="table">
		<thead>
			<tr role="head">
				<th width="50">选择</th>
				<th width="50">ID</th>
				<th>标题</th>
				<th class="cola">栏目</th>
				<th width="50">审核</th>
				<th width="145">更新时间</th>
				<th class="cola">操作</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
</div>
<div id="mobile" class="m-form" style="display:none; float:left">
<div class="f-sep10"></div>
<div class="f-sep10"></div>
	<select name="audit_cid"  id="audit_cid" >
		<option value="">======选择栏目======</option>
		<!--foreach:{$category_list $vo}-->
			<option <?php if($vo['type']==0 || $vo['mid']<>$model_info['mid']){ ?>  value="0" style="background-color:#ccc"  disabled="disabled" <?php }else{ ?>  value="{$vo['cid']}" <?php } ?> >
			
                  {$vo['cname']}
              
			</option>
			<!--{/foreach}-->
	</select>
	<button type="button"  onClick="audit(4);" class="u-btn u-btn-sm">确认</button>
</div>

<div class="f-cb"></div>
<div class="g-foot-tool">
	<div class="m-tools "> <span class="u-btns">
		<button type="button" onClick="selectall('id[]');"  class="u-btn u-btn-c4 u-btn-sm">全选</button>
		<button type="button" onClick="audit(1);" class="u-btn u-btn-c4 u-btn-sm">发布</button>
		<button type="button" onClick="audit(2);" class="u-btn u-btn-c4 u-btn-sm">草稿</button>
		<button type="button" onClick="audit(3);" class="u-btn u-btn-c4 u-btn-sm">删除</button>
		<button type="button" onClick="$('#mobile').toggle();" class="u-btn u-btn-c4 u-btn-sm">移动</button>
		</span> </div>
	<div class="m-page" id="pages"></div>
</div>
<div class="f-cb"></div>

<div class="f-sep10" ></div>
<div class="f-sep10"></div>
</body>
<script>
var page;
var ajaxload = new function(){}; 
var selectall = new function(){}; 
var del = new function(){}; 
var audit = new function(){}; 
Do.ready('base','page','tip','dialog', function() {
	page = $("#pages").myPagination({
		pageCount:1,
		ajax: {
			on: true,
			pageCountId:'countpage',
			url: '{$url(admin_content/ajax_content_list)}',
			dataType: 'json',
			param:$('#filter_form').serialize(),
			ajaxStart: function() {
				$("#table tbody").html('<tr><td colspan="7"><center>正在加载...请稍候！</center></td></tr>'); 
			},
			callback: function(json) {
				setTimeout(function() {
					$("#table tbody").html(json.info);
				}, 200);
			}
		}
	});
	window.ajaxload = function ajaxload(){
		page.onLoad({
			param:$('#filter_form').serialize()
		});
	};
	$(".images").powerFloat({
		targetMode: "ajax"
	});
	//选择
	window.selectall = function selectall(name){   
		$("[name='"+name+"']").each(function(){//反选   
		if($(this).attr("checked")){   
			  $(this).removeAttr("checked");   
		}else{   
			  $(this).attr("checked",'true');   
		}   
		})  
	}
	//删除
	window.del=function del(url,aid,obj) {
		ajaxpost({
			name:'删除此内容会删除相关联的信息!',
			url:url,
			data:{aid:aid},
			tip:true,
			success:function(){
				$(obj).parent().parent().remove();
			}
		});
	}
	//批量操作
	window.audit=function audit(status){
		var str="";
		$("[name='id[]']").each(function(){//反选   
		if($(this).attr("checked")){
			  str+=$(this).val()+","; 
		}
		})
		
		ajaxpost({
			name:'您确认要继续进行操作吗？操作将无法撤销！',
			url:"{$url(admin_content/batch)}",
			data:{status: status, id:str, cid:$("#audit_cid").val()},
			tip:1,
			success:function(){
				ajaxload();	
			}
		});
	}
		
});
</script>